package com.tj.jinzao.model;

import org.json.JSONObject;

import java.io.Serializable;

/**
 * 健康b报告model
 * Created by wjy on 2018/11/10.
 */

public class Health implements Serializable {

    /**
     * familyId : 0
     * id : 0
     * reportJson : string
     * reportTime : 2019-02-19T12:37:18.428Z
     * type : 0
     * uid : 0
     */

    private int familyId;
    private int id;
    private String reportJson;
    private String reportTime;
    private int type;
    private int uid;
    private String score;
    public String getScores(){
        return score;
    }
    public void setScores(String score){
        this.score=score;
    }

    @Override
    public String toString() {
        return "Health{" +
                "familyId=" + familyId +
                ", id=" + id +
                ", reportJson='" + reportJson + '\'' +
                ", reportTime='" + reportTime + '\'' +
                ", type=" + type +
                ", uid=" + uid +
                '}';
    }

    public String getScore() {
        try {
            JSONObject object = new JSONObject(reportJson);
            double value = object.optDouble("health_score");
            return String.valueOf(value);
        } catch (Exception e) {
        }
        return "0";
    }

    public String getScoreText() {
        try {
            JSONObject object = new JSONObject(reportJson);
            return object.optString("health_status_text");
        } catch (Exception e) {
        }
        return "";
    }

    public void setScore() {

    }

    public int getFamilyId() {
        return familyId;
    }

    public void setFamilyId(int familyId) {
        this.familyId = familyId;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getReportJson() {
        return reportJson;
    }

    public void setReportJson(String reportJson) {
        this.reportJson = reportJson;
    }

    public String getReportTime() {
        return reportTime;
    }

    public void setReportTime(String reportTime) {
        this.reportTime = reportTime;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getUid() {
        return uid;
    }

    public void setUid(int uid) {
        this.uid = uid;
    }
}
